package cn.inbot.shopadmin.module.robot.view.adapter

import cn.inbot.shopadmin.R
import cn.inbot.shopadmin.bean.UserVo
import cn.inbot.shopadmin.constant.BaseConstants

import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder

/**
 * Created by shisenkun on 2021/4/30.
 */
class RobotAdapter (data: MutableList<UserVo>
) : BaseQuickAdapter<UserVo, BaseViewHolder>(R.layout.item_robot, data) {

    override fun convert(helper: BaseViewHolder, item: UserVo) {
       helper.setText(R.id.tvSerialNumber, item.robotSerialNumber)
        when(item.robotModel) {
            BaseConstants.ROBOT_MODEL_P1 -> {
                helper.setText(R.id.tvRobotType, "派宝替身机器人")
                helper.setImageResource(R.id.ivRobotModel, R.mipmap.ic_robot_model_p1_n)
                helper.setGone(R.id.ivCall, false)
                helper.setGone(R.id.ivControl, false)
                helper.setGone(R.id.ivNavigation, true)
            }
            BaseConstants.ROBOT_MODEL_P2 -> {
                helper.setText(R.id.tvRobotType, "派宝替身机器人")
                helper.setImageResource(R.id.ivRobotModel, R.mipmap.ic_robot_model_p1_n)
                helper.setGone(R.id.ivCall, false)
                helper.setGone(R.id.ivControl, false)
                helper.setGone(R.id.ivNavigation, true)
            }
            BaseConstants.ROBOT_MODEL_P3 -> {
                helper.setText(R.id.tvRobotType, "派宝替身机器人")
                helper.setImageResource(R.id.ivRobotModel, R.mipmap.ic_robot_model_p3_n)
                helper.setGone(R.id.ivCall, false)
                helper.setGone(R.id.ivControl, false)
                helper.setGone(R.id.ivNavigation, true)
            }
            BaseConstants.ROBOT_MODEL_T1 -> {
                helper.setText(R.id.tvRobotType, "派宝教育机器人")
                helper.setImageResource(R.id.ivRobotModel, R.mipmap.ic_robot_model_t1_n)
                helper.setGone(R.id.ivCall, false)
                helper.setGone(R.id.ivControl, false)
                helper.setGone(R.id.ivNavigation, true)
            }
            BaseConstants.ROBOT_MODEL_T2 -> {
                helper.setText(R.id.tvRobotType, "派宝教育机器人")
                helper.setImageResource(R.id.ivRobotModel, R.mipmap.ic_robot_model_t1_n)
                helper.setGone(R.id.ivCall, false)
                helper.setGone(R.id.ivControl, false)
                helper.setGone(R.id.ivNavigation, true)
            }
            BaseConstants.ROBOT_MODEL_X1 -> {
                helper.setText(R.id.tvRobotType, "派宝迎宾机器人")
                helper.setImageResource(R.id.ivRobotModel, R.mipmap.ic_robot_model_x1_n)
                helper.setGone(R.id.ivCall, false)
                helper.setGone(R.id.ivControl, false)
                helper.setGone(R.id.ivNavigation, false)
            }
            BaseConstants.ROBOT_MODEL_X2 -> {
                helper.setText(R.id.tvRobotType, "派宝迎宾机器人")
                helper.setImageResource(R.id.ivRobotModel, R.mipmap.ic_robot_model_x2_n)
                helper.setGone(R.id.ivCall, false)
                helper.setGone(R.id.ivControl, false)
                helper.setGone(R.id.ivNavigation, false)
            }
            BaseConstants.ROBOT_MODEL_X3 -> {
                helper.setText(R.id.tvRobotType, "派宝迎宾机器人")
                helper.setImageResource(R.id.ivRobotModel, R.mipmap.ic_robot_model_x3_n)
                helper.setGone(R.id.ivCall, true)
                helper.setGone(R.id.ivControl, true)
                helper.setGone(R.id.ivNavigation, true)
            }
            BaseConstants.ROBOT_MODEL_W1 -> {
                helper.setText(R.id.tvRobotType, "派宝物流机器人")
                helper.setImageResource(R.id.ivRobotModel, R.mipmap.ic_robot_model_w1_n)
                helper.setGone(R.id.ivCall, true)
                helper.setGone(R.id.ivControl, false)
                helper.setGone(R.id.ivNavigation, false)
            }
            BaseConstants.ROBOT_MODEL_W2 -> {
                helper.setText(R.id.tvRobotType, "派宝物流机器人")
                helper.setImageResource(R.id.ivRobotModel, R.mipmap.ic_robot_model_w2_n)
                helper.setGone(R.id.ivCall, true)
                helper.setGone(R.id.ivControl, false)
                helper.setGone(R.id.ivNavigation, false)
            }
            BaseConstants.ROBOT_MODEL_S2 -> {
                helper.setText(R.id.tvRobotType, "派宝安保机器人")
                helper.setImageResource(R.id.ivRobotModel, R.mipmap.ic_robot_model_s2_n)
                helper.setGone(R.id.ivCall, true)
                helper.setGone(R.id.ivControl, false)
                helper.setGone(R.id.ivNavigation, false)
            }
            BaseConstants.ROBOT_MODEL_S3 -> {
                helper.setText(R.id.tvRobotType, "派宝安保机器人")
                helper.setImageResource(R.id.ivRobotModel, R.mipmap.ic_robot_model_s3_n)
                helper.setGone(R.id.ivCall, true)
                helper.setGone(R.id.ivControl, false)
                helper.setGone(R.id.ivNavigation, false)
            }
        }
        addChildClickViewIds(R.id.ivCall, R.id.ivControl, R.id.ivNavigation)
    }
}